package com.tjzx.service;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Property;

import com.tjzx.common.NewsType;
import com.tjzx.common.Pager;
import com.tjzx.dao.EipReserveMedicalDAO;
import com.tjzx.entity.EipReserveMedical;
public class EipReserveMedicalService {
		private EipReserveMedicalDAO eipReserveMedicalDAO;

		public EipReserveMedicalDAO getEipReserveMedicalDAO() {
			return eipReserveMedicalDAO;
		}

		public void setEipReserveMedicalDAO(EipReserveMedicalDAO eipReserveMedicalDAO) {
			this.eipReserveMedicalDAO = eipReserveMedicalDAO;
		}
		
		public EipReserveMedical getReserveMedicalById(java.lang.Integer id) {
			return eipReserveMedicalDAO.findById(id);
		}
		public void addReserveMedical(EipReserveMedical eipReserveMedical) {
			eipReserveMedicalDAO.save(eipReserveMedical);
		}
		public List<EipReserveMedical> getEipReserveMedical(String name,String tel) {
			DetachedCriteria criteria = DetachedCriteria.forClass(EipReserveMedical.class);
			criteria.add(Property.forName("reserveName").eq(name));
			criteria.add(Property.forName("reserveTel").eq(tel));

			criteria.addOrder(Property.forName("id").desc());
			
			List<EipReserveMedical> list = eipReserveMedicalDAO.findAllByCriteria(criteria);
			return list;
		}
	}
